home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / getservent.man < prev    next >
Encoding:
Text File  |  1989-07-14  |  3.2 KB  |  133 lines

  1.  
  2.  
  3.  
  4. GETSERVENT            C Library Procedures             GETSERVENT
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      getservent, getservbyport, getservbyname, setservent,
  10.      endservent - get service entry
  11.  
  12. SSYYNNOOPPSSIISS
  13.      ##iinncclluuddee <<nneettddbb..hh>>
  14.  
  15.      ssttrruucctt sseerrvveenntt **ggeettsseerrvveenntt(())
  16.  
  17.      ssttrruucctt sseerrvveenntt **ggeettsseerrvvbbyynnaammee((nnaammee,, pprroottoo))
  18.      cchhaarr **nnaammee,, **pprroottoo;;
  19.  
  20.      ssttrruucctt sseerrvveenntt **ggeettsseerrvvbbyyppoorrtt((ppoorrtt,, pprroottoo))
  21.      iinntt ppoorrtt;; cchhaarr **pprroottoo;;
  22.  
  23.      sseettsseerrvveenntt((ssttaayyooppeenn))
  24.      iinntt ssttaayyooppeenn
  25.  
  26.      eennddsseerrvveenntt(())
  27.  
  28. DDEESSCCRRIIPPTTIIOONN
  29.      _G_e_t_s_e_r_v_e_n_t, _g_e_t_s_e_r_v_b_y_n_a_m_e, and _g_e_t_s_e_r_v_b_y_p_o_r_t each return a
  30.      pointer to an object with the following structure containing
  31.      the broken-out fields of a line in the network services data
  32.      base, /_e_t_c/_s_e_r_v_i_c_e_s.
  33.  
  34.           struct    servent {
  35.                char *s_name;  /* official name of service */
  36.                char **s_aliases;   /* alias list */
  37.                int  s_port;        /* port service resides at */
  38.                char *s_proto; /* protocol to use */
  39.           };
  40.  
  41.      The members of this structure are:
  42.  
  43.      s_name     The official name of the service.
  44.  
  45.      s_aliases  A zero terminated list of alternate names for the
  46.                 service.
  47.  
  48.      s_port     The port number at  which  the  service  resides.
  49.                 Port numbers are returned in network byte order.
  50.  
  51.      s_proto    The name of the protocol to use  when  contacting
  52.                 the service.
  53.  
  54.      _G_e_t_s_e_r_v_e_n_t reads the next line of the file, opening the file
  55.      if necessary.
  56.  
  57.      _S_e_t_s_e_r_v_e_n_t opens and rewinds the file.  If the _s_t_a_y_o_p_e_n flag
  58.      is non-zero, the net data base will not be closed after each
  59.      call to _g_e_t_s_e_r_v_b_y_n_a_m_e or .IR getservbyport .
  60.  
  61.  
  62.  
  63. Sprite v1.0               May 19, 1986                          1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GETSERVENT            C Library Procedures             GETSERVENT
  71.  
  72.  
  73.  
  74.      _E_n_d_s_e_r_v_e_n_t closes the file.
  75.  
  76.      _G_e_t_s_e_r_v_b_y_n_a_m_e and _g_e_t_s_e_r_v_b_y_p_o_r_t sequentially search from the
  77.      beginning of the file until a matching protocol name or port
  78.      number is found, or until EOF is encountered.  If a protocol
  79.      name  is  also supplied (non-NULL), searches must also match
  80.      the protocol.
  81.  
  82. FFIILLEESS
  83.      /etc/services
  84.  
  85. SSEEEE AALLSSOO
  86.      getprotoent(3N), services(5)
  87.  
  88. DDIIAAGGNNOOSSTTIICCSS
  89.      Null pointer (0) returned on EOF or error.
  90.  
  91. BBUUGGSS
  92.      All information is contained in a static area so it must  be
  93.      copied  if it is to be saved.  Expecting port numbers to fit
  94.      in a 32 bit quantity is probably naive.
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Sprite v1.0               May 19, 1986                          2
  130.  
  131.  
  132.  
  133.